package com.centqk.laihuo.controller;

import com.centqk.laihuo.domain.dto.LoginDTO;
import com.centqk.laihuo.domain.dto.PersonDTO;
import com.centqk.laihuo.service.inf.IPersonService;
import com.centqk.laihuo.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
 * Created by edwin on 3/13/17.
 */

@RestController
@RequestMapping("/person")
public class PersonController {

    @Autowired
    private IPersonService personService ;

    @RequestMapping(value = "/serial/{serial}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    public Result personBySerial(@PathVariable String serial, HttpServletResponse response){
        PersonDTO person = personService.personBySerial(serial);
        return new Result(person);
    }
    @RequestMapping(value = "/login", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public Result login(@RequestBody LoginDTO login){

        return new Result(login.getName()+"  登陆成功,你的密码是："+login.getPasswd());
    }
}
